﻿using System;
using System.Collections.Generic;

namespace CoreLib.Extensions
{
    public static class RangeExt
    {
        public static void ForEachDay( this Range<DateTime> target, Action<DateTime> action )
        {
            var split = new List<DateTime>();
            var current = target.Start;
            while( current <= target.End )
            {
                split.Add( current );
                current = current.AddDays( 1 );
            }
            split.ForEach( action );
        }
    }
}
